\\ Written by Donald T. Becker (dtbecker@prolog.net) IRC: StarDustr
// Please mail any bug reports/comments to the above address with a subject
\\ header of MCF.AMIRX.
//
\\ ** What to do with this file?
// Put this script in ENV: and ENVARC:
\\ Go into Settings->Setup in the menu.
// Click on Events. Under Rexx Command for the Join event, enter the following:
\\ ENV:MCF_JOIN %p Make sure you use a lowercase p.
*/
;OPTIONS RESULTS;parse arg LUser junk LChan junk;User=upper(LUser);Chan=upper(LChan);MCFenv=address();xl=pos(".",MCFenv);Client=substr(MCFenv,xl+1);JChan=substr(Chan,2);if getclip(MCFenv) ~="Y" then;do;"say /Rx Rexx:MCF";exit;end;OGC="GREETS."||Client;OPC="OPS."||Client;Greets=getclip(OGC);Ops=getclip(OPC);if Ops ~="Y"&0=pos(Greets,"CPY") then exit;getmynick;LNick=RESULT;MyNick=upper(LNick);OCC="OPCHAR."||Client;OpChar=getclip(OCC);OpNick=OpChar||MyNick||" ";ZChan="";do chcntr=1 by 1 until ZChan=Chan;getchannel chcntr;ZChan=':'||upper(result);end;npos=pos("@",User);Uname=substr(User,2,npos-1);zpos=pos("!",Uname);Unick=left(Uname,zpos-1);if MyNick=Unick then exit;if Ops ~="Y" then signal DoGreets;getusers chcntr;ChUs=" "||upper(result)||" ";opstat=pos(OpNick,ChUs);if opstat=0 then signal DoGreets;DoOps:;PCH="PRIVCH."||Client;Dst=substr(Chan,2);COP="O"|| Dst||"."||Client;OLC="OPLINE."||Client;OpLine=getclip(COP);PrivCh=getclip(PCH);if 0=pos(Dst,PrivCh) then;OpLine=OpLine||getclip(OLC);auth="";UIP=substr(User,npos+1);apos=1;do cauth=1 by 1 until auth ~="";upos=pos(Uname,OpLine,apos);if upos=0 then signal DoGreets;if auth="" then;do;apos=upos+npos+1;ipos=pos(" ",OpLine,apos);OIP=substr(OpLine,apos,ipos-apos);if 0 ~=pos(OIP,UIP) then;auth=substr(OpLine,upos-3,2);end;end cauth;if auth<50 then signal DoGreets;"say /op "Dst Unick;DoGreets:;if 0=pos(Greets,"CPY") then exit;if Greets ~='C' then signal NotChan;if ~open("Input","MCF:MCF.GChans",'R') then exit;xchans=':'||upper(readln("Input"));do while ~eof("Input");if xchans=Chan then;do;call close("Input");signal NotChan;end;xchans=':'||upper(readln("Input"));end;call close("Input");exit;NotChan:;GNC="GRNICK."||Client;GCC="GCOUNT."||Client;xp=pos('!',LUser)-2;LUser=substr(LUser,2,xp);UUser=upper(LUser);GNick=getclip(GNC);if GNick="" then call FirstNick();if 0 ~=pos(Unick,GNick) then signal NickGreet;GCount=getclip(GCC);if GCount="" then GCount=0;if ~open("Input","MCF:MCF.Greets",'R') then exit;GCount=GCount+1;do cnt=1 by 1 until eof("Input")|cnt=GCount;zx.cnt=readln("Input");end cnt;call close("Input");if cnt<GCount|zx.cnt="" then cnt=1;call setclip(GCC,cnt);xx=zx.cnt;signal SayGreet;FirstNick:;if ~open("Input","MCF:MCF.GNicks",'R') then return;xnt=0;do cnt=1 by 1 until eof("Input");xx=readln("Input");if xx="" then iterate;parse value xx with xnick.cnt xgreet.cnt;znick=upper(xnick.cnt);GNick=GNick znick;if znick=UUser then xnt=cnt;end cnt;call close("Input");call setclip(GNC,GNick);if xnt=0 then return;xx=strip(xgreet.xnt);signal SayGreet;NickGreet:;if ~open("Input","MCF:MCF.GNicks",'R') then exit;do cnt=1 by 1 until xnick=UUser|eof("Input");xx=readln("Input");parse value xx with xnick xmsg;xnick=upper(xnick);end cnt;if xnick ~=UUser then exit;xx=strip(xmsg);SayGreet:;if xx="" then exit;x1="";x2="";sndlit='01'x||"SOUND ";parse value xx with act trest;if upper(act)="/ME" then xx='01'x||"ACTION"||trest||'01'x;if upper(act)="/S" then;do;parse value trest with sfile trest;xx=sndlit||sfile||" ("||sfile||") "||'01'x;x1="Y";trest=strip(trest);if trest ~="" then;do;x2=trest;if upper(left(trest,3))="/ME" then;do;parse value trest with junk trest;x2='01'x||"ACTION"||trest||'01'x;act="/ME";end;end;end;xp=pos('%',xx);xx=xx||" ";LChan=substr(LChan,2);do while xp ~=0;yy=left(xx,xp-1);zz=upper(substr(xx,xp+1,1));select;when zz='C' then lit=LChan;when zz='N' then lit=LNick;when zz='U' then lit=LUser;otherwise lit="";end;xx=yy||lit||substr(xx,xp+2);xp=pos('%',xx,xp);end;SChan=LChan;if Greets='P'|x1="Y" then SChan=LUser;xx=strip(xx);"RAW PRIVMSG "SChan" :"xx;if x2="" then signal DoEcho;xx=strip(x2);xp=pos('%',xx);xx=xx||" ";LChan=substr(LChan,2);do while xp ~=0;yy=left(xx,xp-1);zz=upper(substr(xx,xp+1,1));select;when zz='C' then lit=LChan;when zz='N' then lit=LNick;when zz='U' then lit=LUser;otherwise lit="";end;xx=yy||lit||substr(xx,xp+2);xp=pos('%',xx,xp);end;SChan=LChan;if Greets='P' then SChan=LUser;xx=strip(xx);"RAW PRIVMSG "SChan" :"xx;DoEcho:;if 0=pos(sndlit,xx) then;do;if upper(act)="/ME" then;xx=LNick substr(xx,9,length(xx)-9);"echo P="d2c(27)"««"SChan"»" xx;end;exit